<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
		<title>
			Document
		</title>
		<link rel="stylesheet" type="text/css" href="<?php echo __PUBLIC__?>/Bootstrap/Css/bootstrap.min.css"/>
		<link rel="stylesheet" type="text/css" href="<?php echo __PUBLIC__?>/hdjs/hdjs.css"/>
    	<script type="text/javascript" src="<?php echo __PUBLIC__?>/Admin/jquery-1.8.2.min.js"></script>
    	<script type="text/javascript" src="<?php echo __PUBLIC__?>/hdjs/hdjs.min.js"></script>
	</head>
	<body>
		<form onsubmit="return hd_submit(this,'<?php echo U('GoodsLists/index')?>','<?php echo U('GoodsLists/index',array("gid"=>Q("get.gid")))?>')">
		<table class="table table-bordered table-hover" style="font-size: 14px;">
			<tbody>
				<tr>
					<th>货品ID</th>
						<?php foreach ($arr as $v){?>
							<th><?php echo $v[0]['taname']?></th>
						<?php }?>
					<th>库存</th>
					<th>货号</th>
					<th>操作</th>
				</tr>
				<?php foreach ($gListsData as $Lists_v){?>
				<tr class="info">
					<td><?php echo $Lists_v['glid']?></td>
						<?php foreach ($Lists_v['combine'] as $com_v){?>
						<td><?php echo $com_v?></td>	
						<?php }?>
					<td><?php echo $Lists_v['artnum']?></td>
					<td><?php echo $Lists_v['inventory']?></td>
					<td>
						<a href="<?php echo U('GoodsLists/edit',array('glid'=>$Lists_v['glid'],'gid'=>$Lists_v['goods_lists_gid']))?>" class="btn btn-warning">
							<i class="icon-pencil icon-white">
							</i>修改</a>
						<a href="javascript:;" onclick="if(confirm('确认要删除吗？亲~~')) location.href='<?php echo U("GoodsLists/del",array("glid"=>$Lists_v["glid"],"gid"=>$Lists_v["goods_lists_gid"]))?>'" class="btn btn-danger">
							<i class="icon-trash icon-white">
							</i>删除</a>
					</td>
				</tr>
				<?php }?>
				<!-- 如果已添加数目小于可能情况数目，才出现添加货品的输入框 -->
				<tr class="info">
					<td>添加货品</td>
					<?php foreach ($arr as $arr_v){?>
					<td>
						<select name="spec[]" required="">
							<option value="0">-请选择-</option>
								<?php foreach ($arr_v as $vv){?>
							<option value="<?php echo $vv['gaid']?>"><?php echo $vv['gavalue']?></option>
								<?php }?>
						</select>
					</td>
					<?php }?>
					<td>
						<input type="text" name="artnum">
					</td>
					<td>
						<input type="text" name="inventory" value="货号自动生成" id="inventory" disabled="disabled">
					</td>
					<script type="text/javascript">
						$(function(){
							$('#inventory').attr('disabled',true);
						})
					</script>
					<td>
					</td>
				</tr>
			</tbody>
		</table>
		<input type="hidden" name="goods_gid" value="<?php echo Q('get.gid',0,'intval')?>"/>
		<input type="submit" value="确认添加" class="btn btn-primary btn-block btn-large">
		</form>
	</body>
</html>